﻿<%@ Page Title="" Language="C#" MasterPageFile="~/NewTemplate.Master" AutoEventWireup="true" CodeBehind="EditProfile.aspx.cs" Inherits="PresentationLayer.EditProfile" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
    <style type="text/css">
        .Col1 
        {
            width: 120px;
        }
        .Col2
        {
            width: 400px;
        }
    </style>
    <script type="text/javascript" language="javascript">
        function enableValidator() {
            var passwordField = document.getElementById('<%=Password.ClientID%>');
            var input = passwordField.value;
            if (input.length == 0) {
                ValidatorEnable(document.getElementById('<%=requiredPasswordConfirmation.ClientID%>'), false);
            } else {
                ValidatorEnable(document.getElementById('<%=requiredPasswordConfirmation.ClientID%>'), true);
            }
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlace" runat="server">
    <h1>Edit details</h1>
    <table class="UserDetails">
        <colgroup>
            <col class="Col1" />
            <col class="Col2" />                        
            <col class="Col3" />
        </colgroup>
        <tr>
            <td colspan="3"><h3>Account settings</h3></td>
        </tr>
        <tr>
            <td>E-Mail: </td>
            <td><asp:TextBox runat="server" ID="EMail" class="TextInput" TextMode="SingleLine"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="requiredEmail" runat="server" Display="Dynamic"
                    ControlToValidate="EMail"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Please insert an e-mail address.' />">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regexEmail" runat="server" Display="Dynamic"
                    ControlToValidate="EMail"
                    ValidationExpression="^\s*[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\s*$"
                    Text="<img src='gfx/redCheck.png' alt='*' title='The e-mail address is not valid.' />">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>Password: </td>
            <td><asp:TextBox runat="server" ID="Password" class="TextInput" TextMode="Password" onblur="enableValidator();"></asp:TextBox></td>
            <td>
                <asp:RegularExpressionValidator ID="regexPassword" runat="server" Display="Dynamic"
                    ControlToValidate="Password"
                    ValidationExpression="^[A-Za-z0-9]{8,}$"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Password must be at least 9 characters and can only contain letters and numbers.' />">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>Confirm password: &nbsp;&nbsp;&nbsp;</td>
            <td><asp:TextBox runat="server" ID="ConfirmPassword" class="TextInput" TextMode="Password"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="requiredPasswordConfirmation" runat="server" Display="Dynamic"
                    ControlToValidate="ConfirmPassword"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Please confirm your password.' />">
                </asp:RequiredFieldValidator>
                <asp:CompareValidator ID="comparePassword" runat="server" Display="Dynamic"
                    ControlToValidate="ConfirmPassword"
                    ControlToCompare="Password"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Passwords do not match.' />">
                </asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td colspan="3">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="3"><h3>Profile settings</h3></td>
        </tr>
        <tr>
            <td>First name: </td>
            <td><asp:TextBox runat="server" ID="FirstName" class="TextInput" TextMode="SingleLine"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="requiredFirstname" runat="server" Display="Dynamic"
                    ControlToValidate="FirstName"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Please insert your first name.' />">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regexFirstname" runat="server" Display="Dynamic"
                    ControlToValidate="FirstName"
                    ValidationExpression="^\s*([A-Za-z]|\s)+[A-Za-z]+\s*$"
                    Text="<img src='gfx/redCheck.png' alt='*' title='First name can only contain letters and white spaces.' />">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>Last name: </td>
            <td><asp:TextBox runat="server" ID="LastName" class="TextInput" TextMode="SingleLine"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="requiredLastname" runat="server" Display="Dynamic"
                    ControlToValidate="LastName"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Please insert your last name.' />">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regexLastname" runat="server" Display="Dynamic"
                    ControlToValidate="LastName"
                    ValidationExpression="^\s*([A-Za-z]|\s)+[A-Za-z]+\s*$"
                    Text="<img src='gfx/redCheck.png' alt='*' title='Last name can only contain letters and white spaces.' />">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>About me: </td>
            <td><asp:TextBox runat="server" ID="AboutMe" class="TextInput" TextMode="MultiLine" Rows="5"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>Features: </td>
            <td>
                <asp:CheckBox ID="FullNameCB" runat="server" Text="Show full name" /><br />
                <asp:CheckBox ID="EmailCB" runat="server" Text="Show e-mail" /><br />
                <asp:CheckBox ID="MyEventsCB" runat="server" Text="Show my events" /><br />
                <asp:CheckBox ID="AttendingEventsCB" runat="server" Text="Show events I attend" />
                <br />
                <asp:CheckBox ID="PrivateProfileCB" runat="server" Text="Private Profile" /><br />
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="3">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" class="ButtonCell">                
                <asp:Button runat="server" ID="Update" class="SaveButton" Text="" onclick="UpdateDetails" /> &nbsp;&nbsp;
                <input type="reset" class="ResetButton" value=""/>
            </td>
            <td></td>
        </tr>
    </table>   

    <div id="debugMessage" runat="server">

    </div>
</asp:Content>
